package com.qcby.service.Impl;

import com.qcby.dao.StudentDao;
import com.qcby.entity.Clazz;
import com.qcby.entity.Score;
import com.qcby.entity.Student;
import com.qcby.service.Iface.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.test.context.TestExecutionListeners;

import javax.annotation.Resource;
import java.util.List;

@Service
public class StudentServiceImpl implements StudentService {
    @Resource
    private StudentDao studentDao;

    @Override
    public List<Student> findAll() {
        return studentDao.findAll();
    }

    @Override
    public int findAllCount() {
        return studentDao.findAllCount();
    }

    @Override
    public int findAllCountBySearch(Student student) {
        return studentDao.findAllCountBySearch(student);
    }

    @Override
    public List<Student> findAllBySearch(Student student) {
        return studentDao.findAllBySearch(student);
    }

    @Override
    public int addStudent(Student student) {
        return studentDao.addStudent(student);
    }

    @Override
    public int deleteStudent(int id) {
        studentDao.deleteStudentScore(id);
        return studentDao.deleteStudent(id);
    }

    @Override
    public int updateStudent(Student student) {
        return studentDao.updateStudent(student);
    }

    @Override
    public Student updateStudentInfro(int id) {
        return studentDao.updateStudentInfro(id);
    }

    @Override
    public List<Clazz> loadClass() {
        return studentDao.loadClass();
    }
    @Override
    public Clazz findClassById(String id) {
        System.out.println(id);
        return studentDao.findClassById(id);
    }

    @Override
    public List<Score> oneStudentScore(String id) {
        return studentDao.oneStudentScore(id);
    }
}
